package gameobject.construct;

import com.jme3.scene.shape.Box;
import mygame.Vector3i;
import mygame.Voxel;

public abstract class BaseWorkshop extends Construct {

    /*
    public static BaseWorkshop createInstance() {
        return BaseWorkshop.createInstance(DEFAULT_BASE_VOXEL_LOCATION);
    }

    public static BaseWorkshop createInstance(Vector3i baseVoxelGridLocation) {
        BaseWorkshop instance = new BaseWorkshop();
        instance.init(baseVoxelGridLocation);
        return instance;
    }
    */

    @Override
    protected void addModel() {
	addModelDefault(new Box(Voxel.VOXEL_EXTENT*3, Voxel.VOXEL_EXTENT, Voxel.VOXEL_EXTENT*3));
    }

    @Override
    protected int getNumOccupiedVoxels() {
	return 9;
    }

    @Override
    protected void setLocalTranslationWithRespectToBase() {
        setLocalTranslationWithRespectToBaseDefault();
    }

    @Override
    protected void recalculateOccupiedVoxels() {
	System.out.println("Recalculating occupied voxels...");
        Vector3i tempLocation = baseVoxelGridLocation.clone();
	occupiedVoxels.get(0).setVoxelGridLocation(tempLocation);
	tempLocation.addX(1);
	occupiedVoxels.get(1).setVoxelGridLocation(tempLocation);
	tempLocation.addZ(1);
	occupiedVoxels.get(2).setVoxelGridLocation(tempLocation);
	tempLocation.addX(-1);
	occupiedVoxels.get(3).setVoxelGridLocation(tempLocation);
	tempLocation.addX(-1);
	occupiedVoxels.get(4).setVoxelGridLocation(tempLocation);
	tempLocation.addZ(-1);
	occupiedVoxels.get(5).setVoxelGridLocation(tempLocation);
	tempLocation.addZ(-1);
	occupiedVoxels.get(6).setVoxelGridLocation(tempLocation);
	tempLocation.addX(1);
	occupiedVoxels.get(7).setVoxelGridLocation(tempLocation);
	tempLocation.addX(1);
	occupiedVoxels.get(8).setVoxelGridLocation(tempLocation);
        System.out.println(occupiedVoxels);
    }
}
